package com.sas.dao.impl;

import java.util.List;

import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import com.sas.dao.BaseDao;
import com.sas.dao.ShangpinDao;
import com.sas.entity.Shangpin;
import com.sas.entity.Chukudan;
import com.sas.entity.Page;
/**
 * daoΨһ�־û���
 * 
*/
@Repository("shangpinDao")
public class ShangpinDaoImpl extends BaseDao implements ShangpinDao{
    //��ѯ����Shangpin����
	public List<Shangpin> selectShangpin() {
		return getSqlSession().selectList("shangpin.selectShangpin");
	}
    //ɾ�����
	public int deleteShangpin(Shangpin I) {
		// TODO Auto-generated method stub
		return getSqlSession().delete("shangpin.deleteShangpin",I);
	}
    //��Ӷ���
	public int insertShangpin(Shangpin I) {
		// TODO Auto-generated method stub
		return getSqlSession().insert("shangpin.insertShangpin",I);
	}
	//�޸�
	public int updateShangpin(Shangpin I) {
		// TODO Auto-generated method stub
		return getSqlSession().update("shangpin.updateShangpin",I);
	}
     //��ѯҳ��
	public int selectCount() {
		// TODO Auto-generated method stub
		return getSqlSession().selectOne("shangpin.selectCount");
	}
   
	//��ҳ
	public List<Shangpin> selectByShangpin(Shangpin I, Page page) {
		// TODO Auto-generated method stub
		return getSqlSession().selectList("shangpin.selectByShangpin",I,new RowBounds((page.getIndex()-1)*page.getSize(), page.getSize()));
	}
	@Override
	public int insertList(List<Chukudan> in) {
		// TODO Auto-generated method stub
		  return getSqlSession().insert("shangpin.insertOrderDish", in);
	}
	@Override
	public int truncate() {
		// TODO Auto-generated method stub
		return getSqlSession().update("shangpin.truncateTable");
	}
	@Override
	public int insertList1(List<Chukudan> in) {
		// TODO Auto-generated method stub
		return getSqlSession().insert("shangpin.insertOrderDish_1", in);
	}
	@Override
	public List<Chukudan> selectChukudan() {
		// TODO Auto-generated method stub
		return getSqlSession().selectList("shangpin.selectChukudan");
	}
	
}
